import {Configuration} from "log4js";

export let log4jsConfig:Configuration = {
    appenders: {
        debug: {
            type: 'console',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh.mm.ss} %[%p [%18c]%] %m',
            },
        },
        info: {
            type: 'dateFile',
            filename: 'logs/app.log',
            pattern: 'yyyy-MM-dd.log',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh.mm.ss} %p [%18c] %m',
            }
        },
        //错误日志 type:过滤类型logLevelFilter,将过滤error日志写进指定文件
        errorLog: {
            type: 'dateFile', filename: 'logs/error.log', pattern: '-yyyy-MM-dd.log',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh.mm.ss} %p [%18c] %m',
            }
        },
        error: { type: "logLevelFilter", level: "error", appender: 'errorLog' }
    },
    categories: {
        default: { appenders: ['debug','info','error'], level: 'debug' },
        info: {appenders: ['info','error'], level: 'info'}
    },
}